<p>处理捕获的异常时，应记录或转发原始异常的消息和堆栈跟踪。</p>
<h2>不规范的代码示例</h2>

<pre>
 // 不合规-异常丢失
try { /* ... */ } catch (Exception e) { LOGGER.info("context"); }   

// Noncompliant - exception is lost (only message is preserved)       
try { /* ... */ } catch (Exception e) { LOGGER.info(e.getMessage()); }   

// Noncompliant - exception is lost 
try { /* ... */ } catch (Exception e) { throw new RuntimeException("context"); }
</pre>
<h2>正确的解决方案</h2>

<pre>
try { /* ... */ } catch (Exception e) { LOGGER.info(e); }   

try { /* ... */ } catch (Exception e) { throw new RuntimeException(e); }

try {
  /* ... */
} catch (RuntimeException e) {
  doSomething();
  throw e;
} catch (Exception e) {
  // 也允许转换为未经检查的异常
  throw new RuntimeException(e);
}
</pre>
<h2>例外</h2>

<p><code>可以将InterruptedException </code>，<code> NumberFormatException </code>，<code> ParseException </code>和<code> MalformedURLException </code>异常用于指示非异常结果。</p>
<pre>
int myInteger;
try {
  myInteger = Integer.parseInt(myString);
} catch (NumberFormatException e) {
  // It is perfectly acceptable to not handle "e" here
  myInteger = 0;
}

</pre>

